package ai.people.netmon.facebook.probe.controller;


import ai.people.netmon.facebook.probe.service.FacebookGroupService;
import ai.people.netmon.framework.domain.facebook.probe.entity.FacebookGroup;
import ai.people.netmon.framework.domain.facebook.probe.request.QueryRequest;
import ai.people.netmon.framework.model.response.PageResponse;
import ai.people.netmon.framework.model.response.Result;
import ai.people.netmon.framework.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.util.List;

/**
    探测-facebook-群组接口
 *
 * @author zhenglin
 * @since 2022-03-11
 */
@RestController
@RequestMapping("/probe/group")
public class FacebookGroupController {

    @Autowired
    private FacebookGroupService service;

    /**
     * 分页查询页面
     *
     * @param request 请求vo
     * @return {@link Result}<{@link PageResponse}<{@link FacebookGroup}>>
     */
    @PostMapping("/list")
    Result<PageResponse<FacebookGroup>> queryPage(@RequestBody QueryRequest request) {
        PageResponse<FacebookGroup> list = service.queryPage(request);
        return ResultUtil.success(list);
    }

    /**
     * 添加facebook群组
     *
     * @param account facebook群组
     * @return {@link Result}<{@link Boolean}>
     */
    @PostMapping("/")
    Result<Boolean> add(@Valid @RequestBody FacebookGroup account){
        //service.saveAccount(account);
        return ResultUtil.success();
    }

    /**
     * 更新facebook群组信息
     *
     * @param account facebook群组
     * @return {@link Result}<{@link Boolean}>
     */
    @PutMapping
    Result<Boolean> update(@RequestBody FacebookGroup account){
        //service.updateAccount(account);
        return ResultUtil.success();
    }

    /**
     * 通过用户id获取facebook用户信息
     *
     * @param id 用户ID
     * @return {@link Result}<{@link FacebookGroup}>
     */
    @GetMapping("/{id}")
    Result<FacebookGroup> getUserById(@PathVariable("id") @NotBlank Long id){
        //FacebookGroup account = service.getUserById(id);
        return ResultUtil.success(null);
    }

    /**
     * 批量保存facebook群组信息
     *
     * @param list facebook群组信息集合
     * @return {@link Result}<{@link Boolean}>
     */
    @PostMapping("/batchSave")
    Result<Boolean> saveBatch(@RequestBody List<FacebookGroup> list){
        //service.saveBatchData(list);
        return ResultUtil.success();
    }

}
